stream: uncork fromWritable writev on chunk error#63295
Open
trivikr wants to merge 2 commits into
Open
Conversation
Ensure fromWritable().writev() uncorks the wrapped Writable when converting a later chunk throws. This prevents an internal cork from leaking after ERR_INVALID_ARG_TYPE. Fixes: nodejs#63294 Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63295 +/- ##
==========================================
- Coverage 90.05% 90.05% -0.01%
==========================================
Files 714 714
Lines 225247 225261 +14
Branches 42578 42578
==========================================
+ Hits 202842 202852 +10
- Misses 14181 14187 +6
+ Partials 8224 8222 -2
🚀 New features to boost your workflow:
|
jasnell
approved these changes
May 14, 2026
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
fromWritable().writev()leaving the wrapped classicWritablecorked when conversion of a later chunk throws.
Previously,
writev()calledwritable.cork()before converting allchunks. If
toUint8Array()threw, for example withwriter.writev([new Uint8Array([1]), 42]), execution skippedwritable.uncork()and leftwritable.writableCorked === 1.This wraps the corked batch write in
try/finallyso the internal corkis always released, and adds a regression test for the invalid later
chunk case.
Fixes: #63294
Assisted-by: openai:gpt-5.5